package com.qys.livesMall.shop.controller.sys;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.framework.view.QysPage;
import com.qys.livesMall.shop.modal.dto.ShopReturnAuditDTO;
import com.qys.livesMall.shop.modal.dto.ShopReturnSearch;
import com.qys.livesMall.shop.modal.entity.ReturnPurchaseDetails;
import com.qys.livesMall.shop.service.ShopReturnApprovedService;
import com.qys.livesMall.shop.service.ShopReturnPurchaseService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * 后端-采购退货
 *
 */
@RestController
@Tag(name = "退货", description = "退货")
@RequestMapping("/shopReturnApproved")
public class SysShopReturnApprovedController {
    @Resource
    private ShopReturnApprovedService approvedService;
    @Resource
    private ShopReturnPurchaseService purchaseService;

    @Operation(summary = "查询")
    @PostMapping("/search")
    public R<QysPage<ReturnPurchaseDetails>> search(@RequestBody ShopReturnSearch search){
        QysPage<ReturnPurchaseDetails> list = approvedService.search(search);
        return R.ok(list);
    }

    @Operation(summary = "审核通过")
    @PostMapping("/auditPass")
    public R auditPass(@RequestBody ShopReturnAuditDTO auditDTO){
        return purchaseService.auditPass(auditDTO);
    }

    @Operation(summary = "审核不通过")
    @PostMapping("/auditNoPass")
    public R auditNoPass(@RequestBody ShopReturnAuditDTO auditDTO){
        return purchaseService.auditNoPass(auditDTO);
    }

}
